package com.thirtydays.frame.ui.pop

import android.content.Context
import com.lxj.xpopup.core.BottomPopupView
import com.thirtydays.frame.R
import com.thirtydays.frame.databinding.PhotoPopViewBinding
import com.thirtydays.frame.util.ext.clicks

/**
 * @创建者：小垚
 * @时间：2021/8/149:37
 * @描述：
 */
class PhotoPopView(context: Context, onClick: (Int) -> Unit) : BottomPopupView(context) {
    override fun getImplLayoutId() = R.layout.photo_pop_view

    private lateinit var viewBinding: PhotoPopViewBinding
    private val mOnClick = onClick
    override fun onCreate() {
        viewBinding = PhotoPopViewBinding.bind(bottomPopupContainer.getChildAt(0))

        viewBinding.cancelAtv.clicks {
            dismiss()
        }

        viewBinding.patAtv.clicks {
            mOnClick(0)
            dismiss()
        }

        viewBinding.photoAtv.clicks {
            mOnClick(1)
            dismiss()
        }

    }
}